<template>
    <view class="content">
        <image class="logo" :src="Imgs"></image>
        <view class="text-area">
            <button class="title" @click="pictureClick()">{{title}}</button>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                title: '调用相机',
                Imgs: '/static/logo.png'
            }
        },
        onLoad() {

        },
        methods: {
            // 调用手机相机
            pictureClick () {
                uni.chooseImage({
                    count: 1,
                    sizeType: ['original', 'compressed'],
                    sourceType: ['camera','album'], //这要注意，camera掉拍照，album是打开手机相册
                    success: (res)=> {
                        // console.log(res);
                        const tempFilePaths = res.tempFilePaths;
                        this.Imgs = res.tempFilePaths[0]
                        // this.$forceUpdate();
                        // console.log(this.Imgs)
                    }
                });
            }
        }
    }
</script>

<style>
    .content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .logo {
        height: 200rpx;
        width: 200rpx;
        margin-top: 200rpx;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 50rpx;
    }

    .text-area {
        display: flex;
        justify-content: center;
    }

    .title {
        font-size: 36rpx;
        color: #8f8f94;
    }
</style>
